import React, { Fragment, useState, useEffect } from 'react';
import type { FC } from 'react';
import { Calendar, Badge, Drawer } from 'antd';
import style from './index.less';
import { Link, useHistory } from 'umi';
import { LineChart } from 'bizcharts';
import { getPvSum } from './service';
import { nextDay } from '@/utils/nextDay';
const Choose: FC<Record<string, any>> = () => {
  const history = useHistory();
  const [pvData, setPvData] = useState([]);
  const fetchPv = async () => {
    const { data } = await getPvSum({});
    setPvData(nextDay(7, data));
    console.log(nextDay(7, data), '🐷');
  };
  useEffect(() => {
    fetchPv();
  }, []);
  return (
    <div className={style.cal}>
      <LineChart
        data={pvData}
        title={{
          visible: true,
          text: '文章访问量趋势',
          style: { color: 'rgb(28,156,254)' },
        }}
        height={350}
        width={400}
        xField="date"
        yField="count"
        color="rgb(28,156,254)"
      />
    </div>
  );
};
export default Choose;
